package com.hckj.medical.controller;


import com.hckj.medical.entity.Department;
import com.hckj.medical.service.IDepartmentService;
import com.hckj.medical.utils.Code;
import com.hckj.medical.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hckj
 * @since 2023-11-25
 */
@RestController
@RequestMapping("/medical/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;
    /**
     * 查询所有的就诊科室
     */
    @GetMapping("/all")
    public R selectAll(){
        List<Department> all = departmentService.findAll();
        if (!all.isEmpty()){
            return new R(Code.GET_OK,all,"查询成功");
        }else {
            return new R(Code.GET_ERRO,"查询失败");
        }
    }

}
